<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>${zxl:getConfig('productName')}-登录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
   <!-- CSS -->
  <link rel="stylesheet" href="${ctxStatic}/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="${ctxStatic}/login/css/reset.css">
  <link rel="stylesheet" href="${ctxStatic}/login/css/supersized.css">
  <link rel="stylesheet" href="${ctxStatic}/login/css/style.css">
</head>
<body>

        <div class="page-container">
            <h1>${zxl:getConfig('productName')}</h1>
            <form action="#" method="post">
                <input type="text" id="username" name="username" class="username" placeholder="用户名">
                <input type="password" id="password"  name="password" class="password" placeholder="密码">
                <button id ="login_btn" type="button">登录</button>
                <div id = "error" style="margin-top: 10%;display: none;"></div>
            </form>
            
        </div>
        <div style="position: fixed;bottom: 5%;text-align: center;left:50%;margin-left:-250px;">Copyright &copy; 1993-${zxl:getConfig('copyrightYear')} <a style="color: #fff" href="${pageContext.request.contextPath}${zxl:getFrontPath()}">${zxl:getConfig('productName')}</a> - Powered By <a style="color: #fff" href="https://gitee.com/sishuijiekong/projects" target="_blank">${zxl:getConfig('productAuthor')}</a> ${zxl:getConfig('version')}</div>

        <!-- Javascript -->
        <script src="${ctxStatic}/login/js/jquery-1.8.2.min.js"></script>
        <script src="${ctxStatic}/login/js/supersized.3.2.7.min.js"></script>
        <script src="${ctxStatic}/login/js/supersized-init.js"></script>
        <script src="${ctxStatic}/login/js/scripts.js"></script>

    </body>
    
    <script type="text/javascript">
    
    $(function() {
			$("#login_btn").unbind("click");
			$("#login_btn").one("click",login);	
		});
		function login(){
			$.ajax({
				url : "login.html",
				data : {
					"username" : $("#username").val(),
					"password" : $("#password").val()
				},
				type : 'post',
				dataType:'json',
				beforeSend : function() {
				},
				success : function(data) {
					if(data.flag){							
						window.location.href="index.html";						
					}else{		
						$("#error").text(data.message).fadeIn("slow");
						$("#error").fadeOut(3000);		
						$("#login_btn").one("click",login);			
					}
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {					
					$("#error").text("系统错误,请联系管理员").fadeIn("slow");
					$("#error").fadeOut(3000);	
					$("#login_btn").one("click",login);			
				}
			});
		
		}	
    
    </script>
</html>
